{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "alluser=pd.read_csv(r'D:\\学习&科研\\华为手表项目\\华为数据\\base-data\\受试者信息统计表utf8.csv')\n",
    "gluser=pd.read_csv(r'D:\\学习&科研\\华为手表项目\\华为数据\\base-data\\规律跑者信息统计表.csv')\n",
    "#匹配alluser中的行，与赋予gl中"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "     id sex  age  hight  weight  number\n",
      "0  1001   男   23  178.0    70.0    1001\n",
      "1  1002   男   26  188.0    78.0    1002\n",
      "2  1008   男   20  181.0    65.0    1008\n",
      "3  1008   男   20  181.0    65.0    1008\n",
      "4  1009   女   22  160.0    48.0    1009\n"
     ]
    }
   ],
   "source": [
    "# 通过id和number字段进行匹配\n",
    "merged_data = pd.merge(alluser, gluser, left_on='id', right_on='number', how='inner')\n",
    "\n",
    "\n",
    "# 查看合并结果\n",
    "print(merged_data.head())\n",
    "merged_data.to_csv(r'D:\\学习&科研\\华为手表项目\\华为数据\\base-data\\gluser.csv', index=False)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "MLandDL",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.20"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
